<?php

require_once 'PHPUnit.php';
require_once 'CountryDialingCodes.php';

class Country_Dialing_Codes_Test extends PHPUnit_TestCase {
    var $cdc;

    function testNewInstance() {
        $this->cdc = new Telephony_CountryDialingCodes();
        $this->assertTrue(is_a($this->cdc, 'Telephony_CountryDialingCodes'));
    }

    function testCountryCodes() {
        $this->cdc = new Telephony_CountryDialingCodes();
        $array_country_codes = $this->cdc->country_codes(1);
        $this->assertTrue(count($array_country_codes) == 23);
    }


    function testDialingCodes() {
        $this->cdc = new Telephony_CountryDialingCodes();
        $dialcode = $this->cdc->dialing_code('MX');
        $this->assertTrue($dialcode == 52);
    }

    function testExtractDialingCode() {
        $this->cdc = new Telephony_CountryDialingCodes();
        $dialcode = $this->cdc->extract_dialing_code('+4422503584');
        $this->assertTrue($dialcode == 44);
    }
}

$suite = new PHPUnit_TestSuite();
$suite->addTestSuite('Country_Dialing_Codes_Test');
$results = PHPUnit::run($suite);
print $results->toString();
